-
NavigationViewControlleris a fully-featured user interface for turn-by-turn navigation. Do not confuse it with theNavigationControllerclass in UIKit.You initialize a navigation view controller based on a predefined
RouteResponseandNavigationOptions. As the user progresses along the route, the navigation view controller shows their surroundings and the route line on a map. Banners above and below the map display key information pertaining to the route. A list of steps and a feedback mechanism are accessible via the navigation view controller.Route initialization should be configured before view controller’s
viewis loaded. Usually, that is automatically done during any of theinits, but you may also change this settings viaprepareViewLoading(routeResponse:, routeIndex:, routeOptions:, navigationOptions:)methods. For example that could be handy while configuring a ViewController for aUIStoryboardSegue.To be informed of significant events and decision points as the user progresses along the route, set the
NavigationService.delegateproperty of theNavigationServicethat you provide when creating the navigation options.CarPlayNavigationViewControllermanages the corresponding user interface on a CarPlay screen.See moreImportant
Creating an instance of this type with parameters that usesRouteControllerwith will start an Active Guidance session. The trip session is stopped when the instance is deallocated. For more info read the Pricing Guide.Declaration
Swift
open class NavigationViewController : UIViewController, NavigationStatusPresenter, NavigationViewData, BuildingHighlightingextension NavigationViewController: NavigationMapViewDelegateextension NavigationViewController: NavigationServiceDelegateextension NavigationViewController: StyleManagerDelegateextension NavigationViewController: TopBannerViewControllerDelegateextension NavigationViewController: BottomBannerViewControllerDelegateextension NavigationViewController: CarPlayConnectionObserver -
The
NavigationViewControllerDelegateprotocol provides methods for configuring the map view shown by aNavigationViewControllerand responding to the cancellation of a navigation session.For convenience, several location-related methods in the
See moreNavigationServiceDelegateprotocol have corresponding methods in this protocol.Declaration
Swift
public protocol NavigationViewControllerDelegate : VisualInstructionDelegate -
A route voice controller monitors turn-by-turn navigation events and triggers playing spoken instructions as audio using the instance of
SpeechSynthesizingtype.You initialize a voice controller using a
NavigationServiceinstance. The voice controller observes when the navigation service hints that the user has passed a spoken instruction point and responds by calling it’sspeechSynthesizerto handle the vocalization.If you want to use your own custom
SpeechSynthesizingimplementation - also pass it during initialization. If no implementation is provided -MultiplexedSpeechSynthesizerwill be used by default.You can also subclass
See moreRouteVoiceControllerto implement you own mechanism of monitoring navgiation events and callingspeechSynthesizer.Declaration
Swift
open class RouteVoiceController : NSObject, AVSpeechSynthesizerDelegateextension RouteVoiceController: AVAudioPlayerDelegate -
Protocol for implementing speech synthesizer to be used in
See moreRouteVoiceController.Declaration
Swift
public protocol SpeechSynthesizing : AnyObject -
The
See moreSpeechSynthesizingDelegateprotocol defines methods that allow an object to respond to significant events related to spoken instructions.Declaration
Swift
public protocol SpeechSynthesizingDelegate : AnyObject, UnimplementedLogging -
See moreSpeechSynthesizingimplementation, usingMapboxSpeechframework. Uses pre-caching mechanism for upcoming instructions.Declaration
Swift
open class MapboxSpeechSynthesizer : NSObject, SpeechSynthesizingextension MapboxSpeechSynthesizer: AVAudioPlayerDelegate -
See moreSpeechSynthesizingimplementation, usingAVSpeechSynthesizer.Declaration
Swift
open class SystemSpeechSynthesizer : NSObject, SpeechSynthesizingextension SystemSpeechSynthesizer: AVSpeechSynthesizerDelegate -
See moreSpeechSynthesizingimplementation, aggregating other implementations, to allow ‘fallback’ mechanism. Can be initialized with array of synthesizers which will be called in order of appearance, until one of them is capable to vocalize currentSpokenInstructionDeclaration
Swift
open class MultiplexedSpeechSynthesizer : SpeechSynthesizingextension MultiplexedSpeechSynthesizer: SpeechSynthesizingDelegate -
A error type returned when encountering errors in the speech engine.
See moreDeclaration
Swift
public enum SpeechError : LocalizedError -
Declaration
Swift
public enum SpeechFailureAction : String -
Customization options for the turn-by-turn navigation user experience in a
NavigationViewController.A navigation options object is where you place customized components that the navigation view controller uses during its lifetime, such as styles or voice controllers. You would likely use this class if you need to specify a Mapbox access token programmatically instead of in the Info.plist file.
See moreNote
NavigationOptionsis designed to be used with theNavigationViewControllerclass to customize the user experience. To specify criteria when calculating routes, use theNavigationRouteOptionsclass. To modify user preferences that persist across navigation sessions, use theNavigationSettingsclass.Declaration
Swift
open class NavigationOptions : NavigationCustomizable -
A view that represents the root view of the MapboxNavigation drop-in UI.
Components
- InstructionsBannerView
- InformationStackView
- BottomBannerView
- ResumeButton
- WayNameLabel
- FloatingStackView
- NavigationMapView
- SpeedLimitView
See more+--------------------+ | 1 | +--------------------+ | 2 | +---+------------+---+ | 8 | | | +---+ | 6 | | | | | 7 +---+ | | | | | | +------------+ | | 4 || 5 | | +------------+-------+ | 3 | +--------------------+Declaration
Swift
@IBDesignable open class NavigationView : UIView
Install in Dash
Turn-by-turn UI Reference